﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using SSP;

namespace SSPDemo
{
    class Title : SSPScene
    {
        SSPSprite title;
        int fadeValue;
        int timer;
        public Title()
        {
            title = new SSPSprite("savage");
            title.visible = false;
            title.position = new Vector2(640, 360);
            timer = 0;
            fadeValue = 255;
            this.addChild(title);
        }

        public override void update()
        {
            //Console.WriteLine("t={0} f={1} a={2}", timer,fadeValue,title.color.A);
            timer++;
            if( timer == 50 )
            {
                title.visible = true;
            }
            if (timer > 150)
            {
                if (fadeValue > 0)
                {
                    fadeValue--;
                    title.color = new Color(255, 255, 255, (byte)fadeValue); 
                }
            }
            if (timer == 225)
            {
                // next scene;
                SSPDirector.Instance.replaceScene(new MainMenuScene());
            }
            
            base.update();
        }
    }
}
